﻿using System;
using System.Collections.Generic;
using System.Text;
using SIOsystem.Model.ClassifyDataSetTableAdapters;

namespace SIOsystem.Control
{
    class DeptClass
    {
        static public bool addProject(int ProjectID, string ProjectName, string ProjectPlace, string SendAddr
                                    , string Connecter, string Payer, string Status)
        {
            try
            {
                using (ProjectMangeTableAdapter db = new ProjectMangeTableAdapter())
                {
                    if (db.InsertProject(ProjectID, ProjectName, ProjectPlace, SendAddr, Connecter, Payer, Status) > 0)
                    {
                        return true;
                    } 
                    else
                    {
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("增加项目出错", ex);
            }
        }

        static public bool modProject(string ProjectName, string ProjectPlace, string SendAddr
                                    , string Connecter, string Payer, string Status,long PID)
        {
            try
            {
                using (ProjectMangeTableAdapter db = new ProjectMangeTableAdapter())
                {
                    if (db.UpdateProject(ProjectName, ProjectPlace, SendAddr, Connecter, Payer, Status, PID) > 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("修改项目出错", ex);
            }
        }
    }
}
